#include <STC15F2K60S2.H>
#include "Relay.h"
#include "Delay.h"

sbit Key_4 = P3^0;
sbit Key_3 = P3^1;
sbit Key_2 = P3^2;
sbit Key_1 = P3^3;

unsigned char Key()
{
	 unsigned char Key_Nunber = 0;
	P3=0xff;
	if(Key_1 == 0){Delay(20);while(Key_1 == 0)Delay(20);Key_Nunber = 1;}
	if(Key_2 == 0){Delay(20);while(Key_2 == 0)Delay(20);Key_Nunber = 2;}
	if(Key_3 == 0){Delay(20);while(Key_3 == 0)Delay(20);Key_Nunber = 3;}
	if(Key_4 == 0){Delay(20);while(Key_4 == 0)Delay(20);Key_Nunber = 4;}
	return Key_Nunber;
}

void main(void)
{
	Latch_Init(0xa0,0x00);
	while(1)
	{
		unsigned char KeyNunber = Key();
		
		switch(KeyNunber)
		{
			case 1://Nixie_Show(1,i);break;
			case 2://Nixie_Show(1,i);break;
			case 3://
			case 4:Nixie_Show(1,KeyNunber);Latch_Init(0x80,~KeyNunber);//break;
		}
		
	}
	
}
